var dynamicip = '';

function remotejs(url, callback, jsonObject){
	var date = new Date();
	var dcsSrc = url + '?r=' + date.valueOf() + "&callback=" + callback + '&jsonString=' + objectToJSONString(jsonObject);
	var dcs = document.createElement('script');
	dcs.id='scriptsrc' + date.valueOf();
	dcs.type = 'text/javascript';
	dcs.language = 'javascript';
	dcs.src = dcsSrc;
	document.getElementsByTagName("head")[0].appendChild(dcs);
	//alert('方法执行完毕');
	//document.body.appendChild(dcs);
}


function remoteRequest(url){
var date = new Date();
var dcsSrc = url + '&r=' + date.valueOf();
	var dcs = document.createElement('script');
	dcs.id='scriptsrc' + date.valueOf();
	dcs.type = 'text/javascript';
	dcs.language = 'javascript';
	dcs.src = dcsSrc;
	document.getElementsByTagName("head")[0].appendChild(dcs);
}

function remoteScript(){
this.request=function(url){
var element = null;
var self = this;
var date = new Date();
var dcsSrc = url + '&r=' + date.valueOf();
element = document.createElement("script");
element.id = 'scriptsrc' + date.valueOf();
element.src = dcsSrc;
element.type = 'text/javascript';
element.language = 'javascript';
document.getElementsByTagName("head")[0].appendChild(element);
element.onreadystatechange = function(){
var state = this.readyState;
if (state == "loaded" || state == "interactive" || state == "complete") {
self.onsuccess();
}
}
if(window.ActiveXObject){
element.onload = function(){
    var state = this.readyState;
    if (state == "loaded" || state == "interactive" || state == "complete") {
    self.onsuccess();
}
}
}else{
element.onload = function(){
self.onsuccess();
}
}
};
}

function objectToJSONString(object){
	if(Object.toJSON){
		return Object.toJSON(object)
	} else {
		return object.toJSONString();
	}
}

function strToJSON(jsonString){
	return eval('('+ jsonString + ')');
}